﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
#if DOT_NET
using Microsoft.VisualStudio.TestTools.UnitTesting;
#else
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
#endif
using StyleMVVM.DependencyInjection;
using StyleMVVM.UnitTests.TestClasses.SimpleObjects;

namespace StyleMVVM.UnitTests.DependencyInjection
{
	[TestClass]
	public class ExportEnvironmentExcludeTests
	{
		[TestMethod]
		public void RuntimeTest()
		{
			var bootstrapper = new Bootstrapper();

			bootstrapper.Container.Environment = ExportEnvironment.RunTime;

			bootstrapper.Container.RegisterAssembly(
				GetType().GetTypeInfo().Assembly);

			bootstrapper.Start();

			var interfaces = bootstrapper.Container.LocateAll<IExportRuntimeTestInterface>();

			Assert.AreEqual(1, interfaces.Count());

			bootstrapper.Shutdown();
		}

		[TestMethod]
		public void DesignTimeTest()
		{
			var bootstrapper = new Bootstrapper();

			bootstrapper.Container.Environment = ExportEnvironment.DesignTime;

			bootstrapper.Container.RegisterAssembly(
				GetType().GetTypeInfo().Assembly);

			bootstrapper.Start();

			var interfaces = bootstrapper.Container.LocateAll<IExportRuntimeTestInterface>();

			Assert.AreEqual(2, interfaces.Count());

			bootstrapper.Shutdown();
		}

		[TestMethod]
		public void UnitTestTest()
		{
			var bootstrapper = new Bootstrapper();

			bootstrapper.Container.Environment = ExportEnvironment.UnitTest;

			bootstrapper.Container.RegisterAssembly(
				GetType().GetTypeInfo().Assembly);

			bootstrapper.Start();

			var interfaces = bootstrapper.Container.LocateAll<IExportRuntimeTestInterface>();

			Assert.AreEqual(2, interfaces.Count());

			bootstrapper.Shutdown();
		}
	}
}